package data.viewmodel_layer.reuse

import androidx.lifecycle.MutableLiveData
import retrofit2.Call

interface BaseViewModel {
    fun <T> performAction(
        resultLiveData: MutableLiveData<Resource<T>>,
        apiCall: () -> Call<T>
    )
}

sealed class Resource<T>(
    val data: T? = null,
    val message: String? = null
) {
    class Success<T>(data: T) : Resource<T>(data)
    class Error<T>(
        message: String? = null,
        data: T? = null
    ) : Resource<T>(data, message)

    class Loading<T> : Resource<T>()
}